<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../js/vue.js"></script>
</head>

<body>
  <div id="app">
    <div v-if="!isLogin">
      <a href="javascript:;" @click="onLogin">登录</a> | <a href="javascript:;">注册</a>
    </div>
    <div v-else>
      welcome dingding
      |
      <a href="javascript:;" @click="onLogout">注销</a>
    </div>
  </div>
  <script>
    var vm = new Vue({
      el: "#app",
      data: {
        isLogin: false
      },
      methods: {
        onLogin() {
          this.isLogin = true;
        },
        onLogout() {
          this.isLogin = false;
        }
      }
    })
  </script>
</body>

</html>